package persentation.presentUniversityDean;

import javax.swing.JOptionPane;

import persentation.presentLogin.LoginFrame;

public class ExceptionHandler {

	private static UniversityDeanFrame uDeanFrame;
	private static LoginFrame loginFrame;
	private static boolean isSolved = false;

	public ExceptionHandler(UniversityDeanFrame uDeanFrame, LoginFrame loginFrame) {
		this.uDeanFrame = uDeanFrame;
		this.loginFrame = loginFrame;
	}

	public static void networkException() {
		if (!isSolved) {
			int i = JOptionPane.showConfirmDialog(null, "网络连接中断，请重新登录！", "故障",
					JOptionPane.YES_NO_OPTION);
			if (i == JOptionPane.YES_OPTION) {
				uDeanFrame.setVisible(false);
				loginFrame.setVisible(true);

			} else {
				uDeanFrame.setVisible(false);
			}
			isSolved = true;
		}

	}

}
